package com.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.Reporter;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class ReportUtil {
	private static String reportName = "接口自动化";

	private static String splitTimeAndMsg = "=======";
	public static void log(String msg) {
		long timeMillis = Calendar.getInstance().getTimeInMillis();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		String dateSdf = sdf.format(timeMillis);
		Reporter.log(splitTimeAndMsg + dateSdf + splitTimeAndMsg + msg, true);
//		Reporter.log(splitTimeAndMsg + msg, true);
	}

	public static String getReportName() {
		return reportName;
	}

	public static String getSpiltTimeAndMsg() {
		return splitTimeAndMsg;
	}

	public static void setReportName(String reportName) {
		if(StringUtil.isNotEmpty(reportName)){
			com.utils.ReportUtil.reportName = reportName;
		}
	}
}

